import Vue from "vue";
import VueRouter from "vue-router";
import Index from "../views/Index.vue";

Vue.use(VueRouter);

const routes = [{
        path: "/",
        name: "index",
        component: Index,
        meta: {
            title: "王者荣耀官方网站-腾讯游戏",
            filex: true,
        },
    },
    {
        path: '/hou',
        name: 'hou',
        component: () => import('../views/Hou.vue'),
        meta:{hid:true,title:"后台管理系统"}
    },
    {
        path: "/ziliao",
        name: "ziliao",
        component: () =>
            import ("../views/Ziliao.vue"),
        redirect: "/ziliao/yingxiong",
        children: [{
                path: "yingxiong",
                name: "yingxiong",
                component: () =>
                    import ("../views/YingXiong.vue"),
                meta: {
                    title: "英雄资料列表项-英雄资料-王者荣耀",
                    a: true,
                },
            },
            {
                path: "daoju",
                name: "daoju",
                component: () =>
                    import ("../views/DaoJu.vue"),
                meta: {
                    title: "装备介绍-王者荣耀官方网站-腾讯游戏",
                    a: true,
                },
            },
            {
                path: "jineng",
                name: "jineng",
                component: () =>
                    import ("../views/JiNeng.vue"),
                meta: {
                    title: "召唤师技能介绍-王者荣耀官方网站",
                    a: true,
                },
            },
        ],
    },
    {
        path: "/raiders",
        name: "raiders",
        component: () =>
            import ("../views/Raiders.vue"),
        meta: {
            title: "王者荣耀攻略-王者荣耀官方网站",
        },
    },
    {
        path: "/about",
        name: "about",
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ "../views/AboutView.vue"),
    },
];

const router = new VueRouter({
    mode: "history",
    base: process.env.BASE_URL,
    routes,
});
router.beforeEach((to, from, next) => {
    document.title = to.meta.title;
    next();
});
export default router;